// 计划管理模块
import request from '@/plugins/axios'
import qs from 'qs'

export default {
    // 获取所有数据
    getAllPlanList(){
        return request({
            url:`/allPlanList`,
            method:'get'
        })
    },
    // 根据id删除数据
    delete(id){
        return request({
            url:'/delete',
            method:'get',
            params:{
                id:id
            }
        })
    },
    // 完单记录
    getPlanStatus(){
        return request({
            url:'/finishDispatch',
            method:'get',
            params:{
                planStatus:1
            }
        })
    },
    // 查询功能
    selectPlanList(selectData){
        return request({
            url:'/getPlanList',
            method:'post',
            data:qs.stringify(selectData)
        })
    },
    // 完成状态,根据id和完成状态来改变
    setPlanStatus(planStatusData){
        return request({
            url:`/planStatus`,
            method:'get',
            params:{
                id:planStatusData.id,
                planStatus:planStatusData.planStatus
            }
        })
    },
    // 新建
    newPlanList(newData){
        return request({
            url:'/setPlanList',
            method:'post',
            data:qs.stringify(newData)
        })
    },
    // 今日派单
    todayDispatch(today){
        return request({
            url:'/todayDispatch',
            method:'get',
            params:{
                date:today
            } 
        })
    },
    // 派单记录
    dispatch(){
        return request({
            url:'/recordDispatch',
            method:'get',
            params:{
                dispatchStatus:1
            }
        })

    }
}
